package com.magnusart.scrumppm.gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;

public class MenuBar
{
	public enum MenuItems {
		NewProject,
		OpenProject,
		AboutProgram;
	}
	
	private MenuItem fileItem;
	private Menu fileSubmenu;
	private MenuItem helpItem;
	private MenuItem newProjectItem;
	private Menu menuBar;
	private MenuItem openProjectItem;
	private Menu helpSubmenu;
	private MenuItem aboutProgramItem;
	
	public MenuBar( Shell shell ) {
		menuBar = new Menu( shell, SWT.BAR );
		shell.setMenuBar( menuBar );
		
		fileItem = new MenuItem( menuBar, SWT.CASCADE );
		fileItem.setText( "&File" );
		
		fileSubmenu = new Menu( shell, SWT.DROP_DOWN );
		fileItem.setMenu( fileSubmenu );
		
		helpItem = new MenuItem( menuBar, SWT.CASCADE );
		helpItem.setText( "&Help" );
		
		helpSubmenu = new Menu( shell, SWT.DROP_DOWN );
		helpItem.setMenu( helpSubmenu );
		
		newProjectItem = new MenuItem( fileSubmenu, SWT.PUSH );
		newProjectItem.setText( "&New project\tCtrl + O" );
		newProjectItem.setAccelerator (SWT.MOD1 + 'N');
		newProjectItem.setData( MenuItems.NewProject );
		
		openProjectItem = new MenuItem( fileSubmenu, SWT.PUSH );
		openProjectItem.setText( "&Open project\tCtrl + O" );
		openProjectItem.setAccelerator( SWT.MOD1 + 'O' );
		openProjectItem.setData( MenuItems.OpenProject );
		
		aboutProgramItem = new MenuItem( helpSubmenu, SWT.PUSH );
		aboutProgramItem.setText("&About ScrumPPM");
		aboutProgramItem.setData( MenuItems.AboutProgram );
	}
		
	public MenuItem getNewProjectItem() {
		return newProjectItem;
	}
	
	public MenuItem getOpenProjectItem() {
		return openProjectItem;
	}

}
